<#assign menu="system">
<#assign submenu="admin_list">
<#include "/system/head.ftl">
<style type="text/css">
.pagination {
    border-radius: 4px;
    display: inline-block;
    margin: 0;
    padding-left: 0;
}
</style>
	<!--main content start-->
	<section id="main-content">
		<section class="wrapper">
        	<!-- page start-->
            <section class="panel">
            	<header class="panel-heading">
               		 角色权限菜单配置
                </header>
                <div class="panel-body">
                	<form id="config_role_menu_form" method="post" class="form-horizontal" autocomplete="off" action="${basePath}/admin/role/configRoleMenu.json">
                     <fieldset>
                     <input type="hidden" name="roleId" value="<#if roleId??>${roleId}</#if>" />
                	<table class="table table-striped table-advance table-hover">
                	<tbody role="alert" aria-live="polite" aria-relevant="all">
                	<#list allMenus as e>
                		<tr class="gradeA odd">
                			<#assign isSelected=0>
                			<#list selectRoleMenus as selected>
                				<#if selected.menuId==e.id>
                					<#assign isSelected=1>
                				</#if>
                			</#list>
                			<td><input type="checkBox" value="${e.id}" name="selectMenuIds" <#if (isSelected==1)>checked</#if>/></td>
                			<td>${e.menuName}</td>
                            <td><#if e.menuUrl??>${e.menuUrl}</#if></td>
                        </tr>
                    </#list>
                    </tbody>
                    </table>
	   				 <div class="form-group">
	                  	<label class="col-sm-2 col-sm-2 control-label"></label>
	                      <button class="btn btn-danger" type="submit">保存</button>
	                  </div>
	                 </fieldset>
	              </form>
                    
                </div>
              </section>
              <!-- page end-->
          </section>
		</section>
		<!--main content end-->
<script type="text/javascript">
	$(function() {
		$('#config_role_menu_form').ajaxForm({
			dataType : 'json',
			success : function(data) {
				if (data.result) {
					bootbox.alert("保存成功，将刷新页面", function() {
						window.location.reload();
					});
				}else{
					showErrors($('#config_role_menu_form'),data.errors);
				}
			},
			error:function(data,textstatus){
		        bootbox.alert({  
		            buttons: {  
		               ok: {  
		                    label: '关闭'
		               }  
		            },
		            message: data.responseText,
		            title: '<@spring.message "system.errorTip"/>',  
		        });
	        }  
		});
	});	
</script>
<#include "/system/foot.ftl">
